import MapLogItemUI = layaUI.main.MapLogItemUI;

class MapLogItem extends MapLogItemUI{

    private _address:string;//地址
    private _model:MapModel;//数据

    constructor() {
        super();
        //数据
        this._model = MapModel.getInstance();
        //添加侦听
        this.txtDesc.on(Laya.Event.LINK,this,this.linkHandler);
    }

    /**
     * 设置数据
     */
    public setData(logVo:LogVo,index:number,isShowMaster:boolean):void{
        this._address = logVo.address;
        var content:string = LangUtils.getText(isShowMaster ? 22 : 8);
        var shortAddress:string = Utils.getShortAddress(logVo.address);
        var countIndex:number = logVo.count;
        var reward:number = 1;
        var replaceStr:string = content.replace("[1]",countIndex+"");
        replaceStr = replaceStr.replace("[2]",this._address);
        replaceStr = replaceStr.replace("[3]",shortAddress);
        replaceStr = replaceStr.replace("[4]",reward+"");
        replaceStr = replaceStr.replace("[5]",logVo.mapIdex+"");
        this.txtDesc.innerHTML = replaceStr;
    }

    //连接点击
    private linkHandler(url:string):void{
        window.open(url);
    }
}